package com.example.springbootasync.services;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class AsyncServices {
    @Async
    public void  hello() {
                try {
                    Thread.sleep(3000); // 随机睡眠几百毫秒
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
        System.out.println("睡眠3秒");
    }
}
